package com.ruoyi.goods.api.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.springframework.context.annotation.Scope;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 商品规格信息对象 bm_specification
 *
 * @author ruoyi
 * @date 2023-08-03
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Scope("prototype")
public class BmSpecification extends BaseEntity
{
  private static final long serialVersionUID = 1L;

  /** 规格id */
  private Long id;

  /** 所属商品id */
  @Excel(name = "所属商品id")
  private Long goodsId;

  /** 规格名称 */
  @Excel(name = "规格名称")
  private String specificationName;

  /** 原价 */
  @Excel(name = "原价")
  private BigDecimal oldPrice;

  /** 现价 */
  @Excel(name = "现价")
  private BigDecimal price;

  /** 库存 */
  @Excel(name = "库存")
  private Long stock;

  /** 警戒库存 */
  @Excel(name = "警戒库存")
  private Long warnStock;

  /** 总销量 */
  @Excel(name = "总销量")
  private Long allSaled;

  /** 月销量 */
  @Excel(name = "月销量")
  private String currentMonth;

  /** 是否上架 0.未上架 1.上架 */
  @Excel(name = "是否上架 0.未上架 1.上架")
  private Long isShelves;

  /** 是否推荐 0.不推荐 1.推荐 */
  @Excel(name = "是否推荐 0.不推荐 1.推荐")
  private Long isRecommond;

  /** 商品图片 */
  @Excel(name = "商品图片")
  private String goodsImgUrl;

  /** 保质期 */
  @Excel(name = "保质期")
  private String qualityPeriod;

  /** 二维码 */
  @Excel(name = "二维码")
  private String barCode;

  /** 生产日期 */
  @JsonFormat(pattern = "yyyy-MM-dd")
  @Excel(name = "生产日期", width = 30, dateFormat = "yyyy-MM-dd")
  private Date productionDate;
  @Excel(name = "零售价")
  private BigDecimal retailPrice;
  @Excel(name = "生产地")
  private String productionPlace;
  @Excel(name = "购买上限")
  private Long purchaseLimit;
  @Excel(name = "起订量")
  private Long minOrderQuantity;
  @Excel(name = "起订价")
  private BigDecimal minOrderPrice;

  private List<BmGoods> bmGoodsList;

  @Override
  public String toString() {
    return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("goodsId", getGoodsId())
            .append("specificationName", getSpecificationName())
            .append("oldPrice", getOldPrice())
            .append("price", getPrice())
            .append("stock", getStock())
            .append("warnStock", getWarnStock())
            .append("allSaled", getAllSaled())
            .append("currentMonth", getCurrentMonth())
            .append("isShelves", getIsShelves())
            .append("isRecommond", getIsRecommond())
            .append("goodsImgUrl", getGoodsImgUrl())
            .append("qualityPeriod", getQualityPeriod())
            .append("barCode", getBarCode())
            .append("productionDate", getProductionDate())
            .append("retailPrice", getRetailPrice())
            .append("productionPlace", getProductionPlace())
            .append("purchaseLimit", getPurchaseLimit())
            .append("minOrderQuantity", getMinOrderQuantity())
            .append("minOrderPrice", getMinOrderPrice())
            .append("bmGoodsList", getBmGoodsList())
            .toString();
  }
}
